package com.knowswift.security.exception;


import com.knowswift.common.common.BaseResponse;
import org.springframework.security.core.AuthenticationException;

/**
 * <p>
 * 可封装BaseResponse响应结果集的异常类
 *
 * @see BaseResponse
 **/


public class AuthException extends AuthenticationException {
    private BaseResponse<?> result;

    public AuthException(String msg, Throwable cause) {
        super(msg, cause);
    }

    public AuthException(String msg) {
        super(msg);
    }

    public AuthException(int code, String msg, Throwable cause) {
        super(msg, cause);
        result = BaseResponse.base(code, msg);
    }

    public AuthException(int code, String msg) {
        super(msg);
        result = BaseResponse.base(code, msg);
    }

    public AuthException(BaseResponse<?> result) {
        super(result.getStatusMsg());
        this.result = result;
    }

    public BaseResponse<?> getBaseResponse() {
        return result;
    }
}
